package com.eigland.eigaland_lib.model

data class RegisterDeviceResponse(val device: Device?  = null) : Model
data class Device(
    val uuid: String = "",
    val name: String = "",
    val oneTimePwd: String? = "",
    val secret: String? = "",
    val deviceType: DeviceType = DeviceType.POS
) : Model {
    enum class DeviceType {
        POS, MOBILE, UNSIGNED
    }
}

data class MovieResponse(
//  val count: MovieCount,
//  val localizedMovieInfos: List<MovieInfo>,
    val movie: Movie = Movie(),
    val movieInfo: MovieInfo = MovieInfo()
//  val organisation: Organisation
) : Model


data class PageResponse<T>(
    val content: List<T>,
    val first: Boolean,
    val last: Boolean,
    val number: Int,
    val numberOfElements: Int,
    val size: Int,
    val totalElements: Int,
    val totalPages: Int
) : Model


data class ShowResponse(
    val show: Show = Show(),
    val cinema: Cinema = Cinema(),
    val house: House = House(),
    val movieVersion: MovieVersion = MovieVersion(),
    val versionTags: List<VersionTag> = emptyList(),
    val movie: Movie = Movie(),
    val congestionLevel: CongestionLevel = CongestionLevel()
) : Model

data class TicketOrderNoRespone(
    val cinema: Cinema,
    val houseName:String,
    val transaction:Transaction,
    val ticketRecords:ArrayList<TicketRecordItem>


):Model

data class SeatPlanResponse(
    val show: Show = Show(),
    val count: ShowCount = ShowCount(),
    val cinema: Cinema = Cinema(),
    val house: House = House(),
    val movieVersion: MovieVersion = MovieVersion(),
    val movie: Movie = Movie(),
    var seatingPlan: SeatPlan = SeatPlan(),
    val versionTags: List<VersionTag> = emptyList(),
    val standingArea: StandingArea = StandingArea(),
    val congestionLevel : CongestionLevel = CongestionLevel()
) : Model


data class LoginResponse(
    val cinema: Cinema,
    val device: Device,
    val refreshToken: String,
    val refreshTokenExpiration: String,
    val roles: List<Role>,
    var houses: List<House>,
    val shift: Shift?,
    val token: String,
    val tokenExpiration: String,
    val user: User

) : Model{
    fun toMyUserAccount(username: String, password: String): MyUserAccount {
        return MyUserAccount(
            loginInfo = this.toLoginInfo(username, password),
            accountInfo = this.toAccountInfo()
        )
    }

    private fun toAccountInfo(): AccountInfo {
        return AccountInfo(
            oAuthToken = this.toOAuthToken(),
            device = this.device,
            roles = this.roles,
            shift = this.shift,
            user = this.user,
            cinema = this.cinema
        )
    }

    private fun toLoginInfo(username: String, password: String): LoginInfo {
        return LoginInfo(username, password)
    }

    private fun toOAuthToken(): OAuthToken = OAuthToken(
        token = token,
        refreshToken = refreshToken,
        expireTime = tokenExpiration,
        refreshTokenTime = refreshTokenExpiration
    )
}